<?php

/** @var \Laravel\Lumen\Routing\Router $router */

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return $router->app->version() . ' - ' . env('APP_ENV');
});

$router->get('/webhook/payssion', 'WebhookController@payssion');
$router->post('/webhook/payssion', 'WebhookController@payssion');
$router->get('/webhook/airwallex', 'WebhookController@airwallex');
$router->post('/webhook/airwallex', 'WebhookController@airwallex');

// 图形验证码
$router->get('/captcha', 'CommonController@captcha');
// 登录
$router->post('/login', 'UserController@login');
// 发送邮件验证码
$router->post('/send-mail-code', 'CommonController@sendEmailCode');
// 注册
$router->post('/register', 'UserController@register');
// FAQ
$router->get('/faq', 'CommonController@faq');

$router->group(['middleware' => 'auth'], function () use ($router) {
    $router->get('/user', 'UserController@info');
    // 更改密码
    $router->post('/user/change-pass', 'UserController@changePass');
    // 动态代理地区列表
    $router->get('/region', 'CommonController@region');
    // 静态代理地区列表
    $router->get('/static-region', 'CommonController@staticRegion');
    // 业务用途
    $router->get('/business', 'CommonController@business');
    // 套餐列表
    $router->get('/goods', 'BuyController@goods');
    // 购买动态套餐
    $router->post('/buy/dynamic', 'BuyController@dynamic');
    // 购买静态套餐
    $router->post('/buy/static', 'BuyController@static');
    // 购买静态套餐
    $router->post('/buy/static-renew', 'BuyController@staticRenew');
    // 检查订单状态
    $router->post('/order-check', 'BuyController@orderCheck');
    // 动态代理订单列表
    $router->get('/record/dynamic-order', 'RecordController@dynamicOrder');
    // 静记代理订单列表
    $router->get('/record/static-order', 'RecordController@staticOrder');
    // 生成动态代理记录
    $router->get('/proxy/dynamic', 'ProxyController@dynamic');
    // 生成动态代理
    $router->post('/proxy/dynamic', 'ProxyController@createDynamic');
    // 删除代理帐号
    $router->delete('/proxy/dynamic', 'ProxyController@destroyDynamic');
    // 下载代理帐号
    $router->get('/proxy/dynamic/export', 'ProxyController@exportDynamic');
    // 生成动态代理记录
    $router->get('/proxy/static', 'ProxyController@static');
    // 流量使用记录
    $router->get('/traffic', 'RecordController@traffic');
    // 用户列表
    $router->get('/manage/user', 'ManageController@userList');
    // 用户信息
    $router->get('/manage/userinfo', 'ManageController@userInfo');
    // 生设密码
    $router->post('/manage/reset-pass', 'ManageController@resetPass');
    // 充值
    $router->post('/manage/recharge', 'ManageController@recharge');
    // 静态充值
    $router->post('/manage/static-recharge', 'ManageController@staticRecharge');
    // 静态续费
    $router->post('/manage/static-renew-recharge', 'ManageController@staticRenewRecharge');
    // 订单列表
    $router->get('/manage/order', 'ManageController@orderList');
    // 订单验证
    $router->post('/manage/order-verify', 'ManageController@orderVerify');
    // 获取支付配置
    $router->get('/manage/pay-config', 'ManageController@payConfig');
    // 保存支付配置
    $router->post('/manage/pay-config', 'ManageController@savePayConfig');
    // 上传图片
    $router->post('/manage/upload', 'ManageController@upload');
    $router->get('/manage/logs', 'ManageController@logs');
    $router->get('/manage/statistics', 'ManageController@statistics');

    // 分销用户
    $router->get('/distribution/info', 'DistributionController@info');
    // 邀请信息
    $router->get('/distribution/invite', 'DistributionController@inviteUserList');
    // 结算信息
    $router->get('/distribution/payoff', 'DistributionController@payoffList');
    // 分销用户列表
    $router->get('/distribution/user', 'DistributionController@userList');
    // 编辑分销用户
    $router->post('/distribution/saveuser', 'DistributionController@saveUser');
    // 结算
    $router->post('/distribution/payoff', 'DistributionController@payoff');
    // 设置分销状态
    $router->post('/distribution/status', 'DistributionController@resetStatus');
    // 渠道统计
    $router->get('/distribution/channel', 'DistributionController@channel');

    $router->post('/logs/intention-purchase', 'LogController@payNowLogs');
});

